<%_ if (!viaService) { _%>

    private final <%= entityClass %>Repository <%= entityInstance %>Repository;
    <%_ if (dto == 'mapstruct') { _%>

    private final <%= entityClass %>Mapper <%= entityInstance %>Mapper;
    <%_ } _%>
    <%_ if (searchEngine == 'elasticsearch') { _%>

    private final <%= entityClass %>SearchRepository <%= entityInstance %>SearchRepository;
    <%_ } _%>
<%_  } else { _%>

    private final <%= entityClass %>Service <%= entityInstance %>Service;
<%_ } _%>

    public <%= constructorName %>(<% if (!viaService) { %><%= entityClass %>Repository <%= entityInstance %>Repository<% if (dto == 'mapstruct') { %>, <%= entityClass %>Mapper <%= entityInstance %>Mapper<% } %><% if (searchEngine == 'elasticsearch') { %>, <%= entityClass %>SearchRepository <%= entityInstance %>SearchRepository<% } %><%  } else { %><%= entityClass %>Service <%= entityInstance %>Service<% } %>) {
        <%_ if (!viaService) { _%>
        this.<%= entityInstance %>Repository = <%= entityInstance %>Repository;
            <%_ if (dto == 'mapstruct') { _%>
        this.<%= entityInstance %>Mapper = <%= entityInstance %>Mapper;
            <%_ } _%>
            <%_ if (searchEngine == 'elasticsearch') { _%>
        this.<%= entityInstance %>SearchRepository = <%= entityInstance %>SearchRepository;
            <%_ } _%>
        <%_  } else { _%>
        this.<%= entityInstance %>Service = <%= entityInstance %>Service;
        <%_ } _%>
    }
